package com.lmc.shuiyin;

import com.lmc.shuiyin.one.util.Utils;
import org.opencv.core.Core;
        import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;

import static org.opencv.core.CvType.CV_8S;

/**
 * @author yangxiaohui
 * @Date: Create by 2018-10-25 19:42
 * @Description:
 */
public class ImageWatermarkUtilMain {
    static{
        //加载opencv动态库
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    }
    public static void main(String[] args){
        Mat img = Utils.read("C:\\tools\\meinv.png",CV_8S);//加载图片
        Mat outImg = ImgWatermarkUtil.addImageWatermarkWithText(img,"cheshen");
        Imgcodecs.imwrite("C:\\tools\\meinv2.png",outImg);//保存加过水印的图片
        //读取图片水印
        Mat watermarkImg = ImgWatermarkUtil.getImageWatermarkWithText(outImg);
        Imgcodecs.imwrite("C:\\tools\\meinv3.png",watermarkImg);//保存获取到的水印
        //部分截图
        Mat img444 = Utils.read("C:\\tools\\444.png",CV_8S);//加载图片
        Mat watermarkImg2 = ImgWatermarkUtil.getImageWatermarkWithText(img444);
        Imgcodecs.imwrite("C:\\tools\\555.png",watermarkImg2);//保存获取到的水印
    }

}